package org.ccay.manage.i18n.servlet;

import java.io.IOException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;

import org.ccay.core.dispatcher.EventUtil;
import org.ccay.core.exception.ApplicationException;
import org.ccay.i18n.events.II18nChangedEventArgs;
import org.ccay.i18n.events.II18nChangedHandler;
import org.ccay.i18n.service.ReloadableResourceBundle;

@Named("/servlet/i18nSync")
public class I18nSyncServlet extends HttpServlet{
	
	private static final long serialVersionUID = 8938504146331365195L;
	
	@Inject
	ReloadableResourceBundle bundle;
	/* (non-Javadoc)
	 * @see www.ccay.org.ccay.web.support.servlet.AbstractInternalServlet#doService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
		//发送事件通知
		try {
			EventUtil.dispatch(II18nChangedHandler.class, this, new II18nChangedEventArgs(), false);
		} catch (ApplicationException e) {
			e.printStackTrace();
		}
	}

}
